/* eslint-disable @typescript-eslint/no-explicit-any */
/*
 *  Copyright 2021 Collate
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *  http://www.apache.org/licenses/LICENSE-2.0
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

 /**
 * This schema defines the schema for Test Case Result Updates for Feed.
 */
export interface TestCaseResult {
    /**
     * Summary of test case execution
     */
    entityTestResultSummary?: Array<any[] | boolean | number | number | null | EntityTestResultSummaryObject | string>;
    /**
     * Summary of test case execution
     */
    parameterValues?: TestCaseParameterValue[];
    /**
     * Test Case Result for last 7 days.
     */
    testCaseResult?: TestCaseResultElement[];
}

export interface EntityTestResultSummaryObject {
    /**
     * 测试用例的状态
     */
    status?: TestCaseStatus;
    /**
     * 测试用例的名称
     */
    testCaseName?: string;
    /**
     * 测试用例执行的时间戳
     */
    timestamp?: number;
    [property: string]: any;
}

/**
 * 测试用例的状态
 *
 * 测试用例运行的状态
 */
export enum TestCaseStatus {
    Aborted = "Aborted",
    Failed = "Failed",
    Queued = "Queued",
    Success = "Success",
}

/**
 * 该模式定义可用于测试用例的参数值
 */
export interface TestCaseParameterValue {
    /**
     * 参数的名称，必须与testCaseParameterDefinition中的参数名称匹配
     */
    name?: string;
    /**
     * 要传递给参数的值，这些值来自用户输入，我们在运行时捕捉此值并进行转换
     */
    value?: string;
    [property: string]: any;
}

/**
 * 用于捕获测试用例结果的模式
 */
export interface TestCaseResultElement {
    /**
     * Number of rows that failed.
     */
    failedRows?: number;
    /**
     * Percentage of rows that failed.
     */
    failedRowsPercentage?: number;
    /**
     * Incident State ID associated with this result. This association happens when the result
     * is created, and will stay there even when the incident is resolved.
     */
    incidentId?: string;
    /**
     * Number of rows that passed.
     */
    passedRows?: number;
    /**
     * Percentage of rows that passed.
     */
    passedRowsPercentage?: number;
    /**
     * 测试用例结果的详细信息
     */
    result?: string;
    /**
     * 用于捕获未匹配指定测试用例的行/列的示例数据
     */
    sampleData?: string;
    /**
     * standard test type: dataType, maxmuim, valuedomain, required
     */
    standardTestType?: string;
    /**
     * 测试用例运行的状态
     */
    testCaseStatus?:  TestCaseStatus;
    testResultValue?: TestResultValue[];
    /**
     * 获取测试用例结果的日期
     */
    timestamp?: number;
    [property: string]: any;
}

/**
 * 用于捕获测试用例结果值的模式
 */
export interface TestResultValue {
    /**
     * 值的名称
     */
    name?: string;
    /**
     * 值的名称
     */
    showName?: string;
    /**
     * 测试结果值
     */
    value?: string;
    [property: string]: any;
}
